package com.example.finalapplication;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager2.adapter.FragmentStateAdapter;

public class MyPageAdapter extends FragmentStateAdapter {

    public MyPageAdapter(@NonNull FragmentActivity fragmentActivity) {
        super(fragmentActivity);
    }

    @NonNull
    @Override
    public Fragment createFragment(int position) {
        if(position==0){
            return FirstFragment.newInstance("first","111");
        }else if(position==1){
            return SecondFragment.newInstance("second","222");
        }else{
            return ThirdFragment.newInstance("third","333");
        }
    }

    @Override
    public int getItemCount() {
        return 3;
    }
}
